package cn.zhaoyun.demo.service;

import cn.zhaoyun.demo.entity.Emp;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Service;

@Service
public class EmpService {
    // @RabbitListener: 消息监听
    // queues: 要监听哪个队列, 数组
    // 也就是可以监听多个队列
    @RabbitListener(queues = {"demo.emps"})
    public void receive(Emp emp) {
        System.out.println("收到消息: " + emp);
    }
}
